import 'package:json_annotation/json_annotation.dart';

part 'repair_order.g.dart';

@JsonSerializable()
class RepairOrderModel {
  /// 标题
  String title;

  /// 维修号
  String orderNo;

  /// 设备名称
  String name;

  /// 设备编号
  String code;

  /// 设备存放位置
  String location;

  /// 紧急程度
  RepairOrderDegreeEnum degree;

  /// 创建时间
  String addTime;

  /// 修改状态
  RepairOrderEnum status;

  RepairOrderModel(
      {required this.title,
      required this.orderNo,
      required this.name,
      required this.code,
      required this.location,
      required this.degree,
      required this.addTime,
      required this.status});

  factory RepairOrderModel.fromJson(Map<String, dynamic> json) =>
      _$RepairOrderModelFromJson(json);

  Map<String, dynamic> toJson() => _$RepairOrderModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}

enum RepairOrderDegreeEnum {
  slow(1, '低'),
  mid(2, '中'),
  fast(3, '急');

  final int value;
  final String label;

  const RepairOrderDegreeEnum(this.value, this.label);
}

enum RepairOrderEnum {
  repair(1, '报修工单'),
  fast(2, '快速工单');

  final int value;
  final String label;

  const RepairOrderEnum(this.value, this.label);
}
